package com.shanzmoo.db.mall.entity.vo;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.shanzmoo.db.mall.entity.MallOrderEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 商城订单分页返回对象
 * @author Gzhao 2021/1/6
 */
@Data
@ApiModel("商城订单分页返回对象")
public class MallOrderPageVO implements Serializable {

    private static final long serialVersionUID = 1758L;

    @ApiModelProperty("订单id")
    private Integer id;

    @ApiModelProperty("订单号")
    private String orderNo;

    @ApiModelProperty("会员姓名")
    private String username;

    @ApiModelProperty("用户ID")
    private Integer memberId;

    @ApiModelProperty("订单状态：0-待支付 1-待发货 2-已发货 3-已完成 9-已关闭")
    private Integer status;

    @ApiModelProperty("支付状态: 0-未支付，1-已支付")
    private Boolean payStatus;

    @ApiModelProperty("支付单号")
    private String payNo;

    @ApiModelProperty("支付类型：1-微信，2-支付宝")
    private Integer payType;

    @ApiModelProperty("订单总金额")
    private BigDecimal amount;

    @ApiModelProperty("商品总金额")
    private BigDecimal goodsAmount;

    @ApiModelProperty("优惠券金额")
    private BigDecimal couponAmount;

    @ApiModelProperty("运费")
    private BigDecimal freight;

    @ApiModelProperty("实付金额")
    private BigDecimal receiveAmount;

    @ApiModelProperty("收货人")
    private String contacts;

    @ApiModelProperty("联系方式")
    private String mobile;

    @ApiModelProperty("地区编号")
    private Integer districtCode;

    @ApiModelProperty("地址名")
    private String districtStr;

    @ApiModelProperty("详细地址")
    private String address;

    @ApiModelProperty("物流公司")
    private String logisticsType;

    @ApiModelProperty("物流单号")
    private String logisticsNo;

    @ApiModelProperty("发票类型：0-普通电子发票")
    private Integer invoiceType;

    @ApiModelProperty("发票单位名称（个人名称）")
    private String invoiceTitle;

    @ApiModelProperty("发票识别号（手机号码）")
    private String invoiceIdentification;

    @ApiModelProperty("发票邮箱")
    private String invoiceEmail;

    @ApiModelProperty("发票内容：0-购物明细，1-数据电子，2-3c类型")
    private Integer invoiceContentType;

    @ApiModelProperty("买家留言")
    private String memberRemark;

    @ApiModelProperty("卖家留言")
    private String sellerRemark;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @ApiModelProperty("下单时间")
    private LocalDateTime createTime;

    @ApiModelProperty("商品明细")
    private List<MallOrderDetailVO> detailList;

    public static MallOrderPageVO create(MallOrderEntity mallOrderEntity) {
        return JSON.parseObject(JSON.toJSONString(mallOrderEntity), MallOrderPageVO.class);
    }
}
